<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>城市物流配送系统 </title>
	<link href="../js/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet">
	<link rel="stylesheet" href="../source/arcgis/arcgis_js_api/library/3.9/3.9compact/js/dojo/dijit/themes/claro/claro.css">
	<link href="../source/arcgis/arcgis_js_api/library/3.9/3.9compact/js/esri/css/esri.css" rel="stylesheet" type="text/css" />
	<link href="../style/main.css" type="text/css" rel="stylesheet">

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
	<style type="text/css">
		body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
	</style>
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=qG1UjK1GUyDjKQoPCY7V6bxR"></script>
</head>
<body>
	<div class="container-fluid p0" style="font-size:17px;">
	<nav class="navbar navbar-default header" role="navigation"> 
	    <!-- Brand and toggle get grouped for better mobile display -->
	    <div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
				<span class="sr-only">toggle</span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
				<span class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="#"><span class="glyphicon glyphicon-map-marker"></span> 城市物流配送路径规划系统 <span class="badge">Beta</span></a>
	    </div>
	    <!-- Collect the nav links, forms, and other content for toggling -->
	    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav navbar-right">
				<li><a href=""><span class="glyphicon glyphicon-user"></span> 管理员，你好！</a></li>
				<li class="dropdown">
				<a href="" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-cog"></span> 操作 <span class="caret"></span></a>
					<ul class="dropdown-menu" role="menu">
						<li><a href="" data-toggle="modal" data-target="#sign">用户注册</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#myModal">用户登录</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#">注销登录</a></li>
					</ul>
				</li>
			</ul>
			<ul class="nav navbar-nav">
				<li><a href="../trafficGIS"> <span class="glyphicon glyphicon-eye-open"></span> 流量预测</a></li>
				<li><a href="bus/1.html" target="bus"><span class="glyphicon glyphicon-plane"></span> 公交</a></li> 

				<li class="dropdown">
					<a href="../" class="dropdown-toggle" data-toggle="dropdown" ng-click="clearVrp()"><span class="glyphicon glyphicon-random"></span> 物流配送
						<b class="caret"></b>
					</a>
					<ul class="dropdown-menu">
						<li><a href="#/dataform"> 参数设置</a></li>
						<li class="divider"></li>
						<li><a href="#/guide">最短路径</a></li>
						<li class="divider"></li>
						<li><a href="#/search">条件查询</a></li>
					</ul>
				</li>

				<li><a href="../#search"><span class="glyphicon glyphicon-search"></span> 条件查询</a></li> 
				<li class="dropdown">
					<a href="../" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-tasks"></span> 信息管理
						<b class="caret"></b>
					</a>
					<ul class="dropdown-menu">
						<li><a href="#/goods">货物信息</a></li>
						<li class="divider"></li>
						<li><a href="#/car">车辆信息</a></li>
						<li class="divider"></li>
						<li><a href="#/driver">驾驶员信息</a></li>	
						<li class="divider"></li>
						<li><a href="">配送点信息</a></li>
						<li class="divider"></li>
						<li><a href="">配送中心信息</a></li>
						<li class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#dataUp">数据导入</a></li>
					</ul>
				</li> 
				<li class="dropdown">
					<a href="../" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-asterisk"></span> 统计分析
						<b class="caret"></b>
					</a>
					<ul class="dropdown-menu">
						<li><a href="#/graph">货物配送数量统计分析</a></li>
						<li class="divider"></li>
						<li><a href="#/graph2">货物配送费用统计分析</a></li>
					</ul>
				</li> 

				<li class="dropdown">
					<a href="../" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-inbox"></span> 公交调度
						<b class="caret"></b>
					</a>
					<ul class="dropdown-menu">
						<li><a href="#/busArrange">排班管理</a></li>
						<li class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#setOffBus">发车调度</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#BAOCHE">添加包车信息</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#FANGKONG">添加放空调度信息</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#QUJIAN">添加区间调度信息</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#CHELIANG">添加车辆信息</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#XGCL">修改车辆信息</a></li>
						<li role="separator" class="divider"></li>
						<li><a href="" data-toggle="modal" data-target="#FKDD">放空调度</a></li>
						<!-- <li><a href="#/">其他</a></li> -->
					</ul>
				</li> 
			</ul>
			
			<!-- <iframe name="bus" style="height: 1154px; width: 982px" src="bus/1.html" frameborder="0" scrolling="no">
			      		</iframe>   -->  
	    </div><!-- /.navbar-collapse -->  
	</nav>
</div>
	<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
	// 百度地图API功能
/*	var map = new BMap.Map("allmap");

	map.centerAndZoom(new BMap.Point(120.072006,30.250863), 17);
	map.addControl(new BMap.MapTypeControl());   //添加地图类型控件
	var myP1 = new BMap.Point(119.995125,30.209765);    //起点
	var myP2 = new BMap.Point(120.14445,30.276459);    //终点
	var myIcon = new BMap.Icon("./bus1.png", new BMap.Size(65, 70), {    //小车图片
		//offset: new BMap.Size(0, -5),    //相当于CSS精灵
		imageOffset: new BMap.Size(0, 0)    //图片的偏移量。为了是图片底部中心对准坐标点。
	  });
	var driving2 = new BMap.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}});    //驾车实例
	driving2.search(myP1, myP2);    //显示一条公交线路*/

	// 百度地图API功能
	var map = new BMap.Map("allmap");
	map.centerAndZoom(new BMap.Point(120.072006,30.250863), 18);
	map.addControl(new BMap.MapTypeControl());   //添加地图类型控件
	map.setZoom(14);
	map.enableScrollWheelZoom(true);
	var bounds = null;
	var linesPoints = null;
	var spoi = new BMap.Point(119.995125,30.209765);    // 起点
	var epoi1 = new BMap.Point(120.14445,30.276459);    //终点1
	var epoi2  = new BMap.Point(119.945422,30.332232);    // 终点2
	var myIcon = new BMap.Icon("./bus1.png", new BMap.Size(65, 70), {imageOffset: new BMap.Size(0, 0)});
	function initLine(){
		bounds = new Array();
		linesPoints = new Array();
		map.clearOverlays();                                                    // 清空覆盖物
		var driving3 = new BMap.DrivingRoute(map,{onSearchComplete:drawLine});  // 驾车实例,并设置回调
			driving3.search(spoi, epoi1);                                       // 搜索一条线路
		var driving4 = new BMap.DrivingRoute(map,{onSearchComplete:drawLine});  // 驾车实例,并设置回调
			driving4.search(spoi, epoi2);                                       // 搜索一条线路
	}
	function run(){
		for(var m = 0;m < linesPoints.length; m++){
			var pts = linesPoints[m];
			var len = pts.length;
			var carMk = new BMap.Marker(pts[0],{icon:myIcon});
			map.addOverlay(carMk);
			resetMkPoint(1,len,pts,carMk)
		}
		
		function resetMkPoint(i,len,pts,carMk){
			carMk.setPosition(pts[i]);
			if(i < len){
				setTimeout(function(){
					i++;
					resetMkPoint(i,len,pts,carMk);
				},100);
			}
		}
		
	}
	function drawLine(results){
		var opacity = 0.45;
		var planObj = results.getPlan(0);
		var b = new Array();
		var addMarkerFun = function(point,imgType,index,title){
			var url;
			var width;
			var height
			var myIcon;
			// imgType:1的场合，为起点和终点的图；2的场合为车的图形
			if(imgType == 1){
				url = "http://developer.baidu.com/map/jsdemo/img/dest_markers.png";
				width = 42;
				height = 34;
				myIcon = new BMap.Icon(url,new BMap.Size(width, height),{offset: new BMap.Size(14, 32),imageOffset: new BMap.Size(0, 0 - index * height)});
			}else{
				url = "http://developer.baidu.com/map/jsdemo/img/trans_icons.png";
				width = 22;
				height = 25;
				var d = 25;
				var cha = 0;
				var jia = 0
				if(index == 2){
					d = 21;
					cha = 5;
					jia = 1;
				}
				myIcon = new BMap.Icon(url,new BMap.Size(width, d),{offset: new BMap.Size(10, (11 + jia)),imageOffset: new BMap.Size(0, 0 - index * height - cha)});
			}
			
			var marker = new BMap.Marker(point, {icon: myIcon});
			if(title != null && title != ""){
				marker.setTitle(title);
			}
			// 起点和终点放在最上面
			if(imgType == 1){
				marker.setTop(true);
			}
			map.addOverlay(marker);
		}
		var addPoints = function(points){
			for(var i = 0; i < points.length; i++){
				bounds.push(points[i]);
				b.push(points[i]);
			}
		}	
		// 绘制驾车步行线路
		for (var i = 0; i < planObj.getNumRoutes(); i ++){
			var route = planObj.getRoute(i);
			if (route.getDistance(false) <= 0){continue;}
			addPoints(route.getPath());
			// 驾车线路
			if(route.getRouteType() == BMAP_ROUTE_TYPE_DRIVING){
				map.addOverlay(new BMap.Polyline(route.getPath(), {strokeColor: "#0030ff",strokeOpacity:opacity,strokeWeight:6,enableMassClear:true}));
			}else{
			// 步行线路有可能为0
				map.addOverlay(new BMap.Polyline(route.getPath(), {strokeColor: "#30a208",strokeOpacity:0.75,strokeWeight:4,enableMassClear:true}));
			}
		}	
		map.setViewport(bounds);	
		// 终点
		addMarkerFun(results.getEnd().point,1,1);
		// 开始点
		addMarkerFun(results.getStart().point,1,0);
		linesPoints[linesPoints.length] = b;
	}
	initLine();
	setTimeout(function(){
		run();
	},1500);

/*	setInterval(function(){
		run();
	},6500);*/
</script>
